package main.util;

/**
 * http请求返回数据封装
 * @author Answer NO.2
 *
 */
public class ResultData {
	
	public static int STATUS_SUCCESS = 1;
	
	public static int STATUS_FAILURE = 0;
	
	public static int EXCEPTION_CODE = 500;
	
	/* 信息码 */
	private Integer code;
	
	/* 提示信息 */
	private String reMsg;
	
	/* 数据 */
	private Object data;
	
	private ResultData(){
		
	}
	
	private ResultData(Integer code,String reMsg,Object data) {
		this.code=code;
		this.reMsg=reMsg;
		this.data=data;
	}

	public static ResultData generateSuccessResultData(String message,Object data) {
		return new ResultData(STATUS_SUCCESS,message,data);
	}
	
	public static ResultData generateFailResultData(String message) {
		return new ResultData(STATUS_FAILURE, message, null);
	}
	
	public static ResultData generateFailResultData(Integer code,String message) {
		return new ResultData(code, message, null);
	}
	
	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getReMsg() {
		return reMsg;
	}

	public void setReMsg(String reMsg) {
		this.reMsg = reMsg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
